package Structural_design_pattern.Composite_Pattern.Example3;

import java.util.ArrayList;
import java.util.List;

public class Folder extends AbstractFile{
    private List<AbstractFile> fileList = new ArrayList<>();
    private String name;

    public void add (AbstractFile element){
        fileList.add(element);
    }

    public void remove (AbstractFile element){
        fileList.remove(element);
    }

    public void display(){
        System.out.println(name);
        for (AbstractFile abstractFile : fileList) {
            abstractFile.display();
        }
    }

    public Folder(String name){
        this.name = name;
    }
}
